﻿@using AppService.Model
@{
    Layout = null;
    var list = ViewData["Top10List"] as List<DoubleColorBall>;
}
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <link href="~/Content/css/site.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <script src="~/Scripts/axios.min.js"></script>
</head>
<body>
<div class="main-content">
    <div class="title">XXXXXXXX</div>
    <div class="year-content">
        <ul>
            <li>2020</li>
            <li>2019</li>
            <li>2018</li>
            <li>2017</li>
            <li>2016</li>
            <li>2015</li>
            <li>2014</li>
            <li>2013</li>
            <li>2012</li>
            <li>2011</li>
            <li>2010</li>
            <li>2009</li>
            <li>2008</li>
            <li>2007</li>
            <li>2006</li>
            <li>2005</li>
            <li>2004</li>
            <li>2003</li>
        </ul>
    </div>
    <div class="ball-content">
        <table class="listable2" >
            <tr>
                <th>年</th>
                <th>日期</th>
                <th>期号</th>
                <th>内容</th>
            </tr>
            @{
                foreach (var item in list)
                {
                    <tr>
                        <td>@item.Year</td>
                        <td>@item.OpenDate.ToString("yyyy-MM-dd")</td>
                        <td>@item.Issue</td>
                        <td>@item.RedBall.Replace(",", " ") <span style="color: blue">@item.BlueBall</span></td>
                    </tr>
                }
            }

        </table>
    </div>


</div>
    



@*<div>
    <ul id="content">

    </ul>
</div>
<input type="text" id="year" placeholder="年" />
<input type="text" id="date" placeholder="日期" />
<input type="text" id="week" placeholder="星期" />
<input type="text" id="issue"  placeholder="" />
<input  type="button" value="提交" id="btnOk" />*@

<script type="text/javascript">
    $("#btnOk").on("click", function () {
        var __year = $("#year").val();
        var __date = $("#date").val();
        var __week = $("#week").val();
        var __issue = $("#issue").val();
        axios({
            url: "/Home/Search",
            method: "post",
            data: {
                year: __year, date: __date, week: __week, issue: __issue
            }
        }).then(res => {
            console.log(res);
            if (res.data.length > 0) {
                for (var i = 0; i < res.data.length; i++) {
                    $("#content").append(`<li>${res.data[i].RedBall}</li>`);
                }
            }

         }).catch(err => {
            console.log(err);
        });
    });
</script>
</body>
</html>